#pragma once


#include "tile_editor.hpp"
#include "palette_editor.hpp"
#include "plane_editor.hpp"
#include "sprite_editor.hpp"
#include "stash.hpp"

#include "about.hpp"
#include "darken_overlay.hpp"
#include "settings.hpp"

#include <QAction>
#include <QApplication>
#include <QKeySequence>
#include <QMainWindow>
#include <QMenu>
#include <QMenuBar>
#include <QObject>
#include <QPoint>
#include <QShortcut>
#include <Qt>
#include <QTabWidget>


class GesusMainWindow : public QMainWindow
{
	Q_OBJECT

public: // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
	
	GesusMainWindow(int, char * []);
								   
private slots: // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

	void slot_select_adjacent_tab(const QKeySequence &);
	void slot_show_hide_dock(QDockWidget &, const bool);
	void slot_toggle_fullscreen(void);
	
private: // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

	QTabWidget  gesusEditorTabs;
	QMenuBar    gesusMenuBar; 

	QDockWidget  gesusPaletteEditorDock = QDockWidget(PALETTE_EDITOR_DOCK_NAME, this);
	QDockWidget  gesusTileStashDock     = QDockWidget(TILE_STASH_DOCK_NAME,     this);
	
	SpriteEditor   gesusSpriteEditor;
	TileEditor     gesusTileEditor;
	TileStash      gesusTileStash;
	PaletteEditor  gesusPaletteEditor;
	PlaneEditor    gesusPlaneEditor;
	
	GesusSettings  gesusSettings;
	GesusAbout     gesusAbout;

	DarkenOverlay darkenOverlay = DarkenOverlay(&gesusTileStashDock, this);
	
	/*  Initialization functions
	 */
	void create_missing_dirs(void);
	void setup_actions(void);
	void setup_editor_tabs(void);
	void setup_main_window(void);
	void setup_menus(void);

	/*  Menus
	 */
	QMenu gesusFileMenu = QMenu("File", this);

	QAction actShowAbout       = QAction( "About", this);
	QAction actExitApplication = QAction( "Exit",  this);

	QMenu gesusViewMenu = QMenu("View", this);

	QAction actShowPaletteEditor = QAction( "Palette Editor", this);
	QAction actShowTileStash     = QAction( "Tile Stash",     this);
	
	/*  Shortcuts
	 */
	QKeySequence kseqExitApplication   = QKeySequence( Qt::CTRL | Qt::Key_Q );
	QKeySequence kseqShowPaletteEditor = QKeySequence( Qt::CTRL | Qt::Key_P );
	QKeySequence kseqShowTileStash     = QKeySequence( Qt::CTRL | Qt::Key_T );
	
	QShortcut scCloseTab          = QShortcut( Qt::CTRL | Qt::Key_W,      this);
	QShortcut scFileMenu          = QShortcut( Qt::CTRL | Qt::Key_F,      this);
	QShortcut scFullscreen        = QShortcut( Qt::Key_F11,               this);
	QShortcut scLeftTab           = QShortcut( Qt::SHIFT | Qt::Key_Left,  this);
	QShortcut scRightTab          = QShortcut( Qt::SHIFT | Qt::Key_Right, this);
	
}; // class GesusMainWindow
